package viewmodel;

import java.util.ArrayList;
import java.util.List;

import admin.dao.GameDAO;
import admin.dao.VideoDAO;

import model.Game;
import model.Video;

public class VideoDataModel {
	private List<Video> allVideo = new ArrayList<Video>();
	
	public VideoDataModel(){
		updateAllVideo();
	}
	
	public List<Video> getAllVideo() {
		return allVideo;
	}
	public void updateAllVideo(){
		this.allVideo = VideoDAO.getAllVideo();
	}
	public void removeVideo(Video selVideo){
		allVideo.remove(selVideo);
		VideoDAO.removeVideo(selVideo);
	}
	public static List<VideoEditStatus> convertVideoToEditDataLi(List<Video> listVideo){
		ArrayList<VideoEditStatus> result = new ArrayList<VideoEditStatus>();
		for(Video video : listVideo){
			VideoEditStatus videoEdit = new VideoEditStatus(video, false);
			videoEdit.setType(new VideoTypeModel(video.getType()));
			result.add(videoEdit);
		}
		return result;
	}
	public List<VideoEditStatus> convertVideoToEditData(){
		return VideoDataModel.convertVideoToEditDataLi(allVideo);
	}
}
